Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Incorrect Display Bounds Calculation for Linux #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Sohimaster
Copy link

@Sohimaster Sohimaster commented Dec 22, 2024

This PR resolves an issue in the GetDisplayBounds function on Linux systems where:

    1. Bounds were incorrectly calculated due to improper handling of absolute coordinates.
    2. Displays with non-standard arrangements produced incorrect bounds.

Changes:

    1. Updated GetDisplayBounds to use absolute coordinates based on xinerama data.

Testing:

    1. Verified the fix using multi-monitor setups on Linux.
    2. Confirmed screenshots correctly match individual monitor bounds.

@Sohimaster
Copy link
Author

@kbinani Hi! Let's merge the fix if you don't have any questions

@kbinani
Copy link
Owner

kbinani commented Dec 23, 2024

@Sohimaster Thanks for the PR. According to the coordinate section in the README, this library treats the top-left of the primary screen as the origin. Your changes seem to break that design. Please review the README’s coordinate section to ensure consistency with our approach.

@Sohimaster
Copy link
Author

@kbinani not really sure what it means but the library wasn't working for me before as it doesn't expect the primary screen to have index different than 0 (as in my setup in the picture)

so when I was taking a screenshot of my primary screen, it would capture the other one instead with an incorrect resolution. As for the other one, it did not capture anything at all. So I did some debugging and found the cause which I fixed in this PR
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants